package com.example.asus.mytianqi;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;

import com.example.asus.mytianqi.Data.Data;
import com.example.asus.mytianqi.Data.weather_Mode;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Data.getAPI().getWether().enqueue(new Callback<weather_Mode>() {
            @Override
            public void onResponse(Call<weather_Mode> call, Response<weather_Mode> response) {
                weather_Mode m=response.body();
                Toast.makeText(MainActivity.this,m.getData().getCity()
                        + m.getData().getGanmao(),Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onFailure(Call<weather_Mode> call, Throwable t) {

            }
        });
    }
}
